#ifndef LIRGAME_H
#define LIRGAME_H

class LIRConnection;
class LIRHand;
class LIRSavedGame;

#define MAXDEALERCARDS 2
#define MAXPLAYERCARDS 3

enum PayTableTypes
{
    PAYFREQ_NORMAL,
    PAYFREQ_ALTERNATE,
    MAX_PAY_FREQUENCIES
};

enum ProgressivePayTableTypes
{
    PROGPAYFREQ_LOW,
    PROGPAYFREQ_MEDIUM,
    PROGPAYFREQ_HIGH,
    PROGPAYFREQ_ALTHIGH,
    MAX_PROGRESSIVE_PAY_FREQUENCIES
};


class LIRGame
{
	public:
		LIRGame(LIRConnection*, int32 bet, int32 progressiveBet);
		LIRGame(LIRConnection*, LIRSavedGame*);
		~LIRGame();

		bool8 deal(int32 balance);
        bool8 continue1(int32 balance);
        bool8 continue2(int32 balance);
		bool8 raise1(int32 balance);
        bool8 raise2(int32 balance);

		int32 getBet();
        int32 getProgressiveBet();

		void send();
		void save(LIRSavedGame*);

		bool8 isGameOK();

        // kharmon.  01-05-06.  #4250.  Used when a player hits a big progressive jackpot.
        virtual bool8 hasMalfunction() { return m_bMalfunction; }

        // kharmon.  01-05-06.  #4250.  Used when a player hits a big progressive jackpot.
        virtual void  setMalfunction(bool8 bMalfunction) { m_bMalfunction = bMalfunction; }

	protected:
		bool8 gameDone(int32);
        bool8 turnOneDone(int32);

		// luke 7/24/02: Modified to return success/failure
		// (the previous return value is the second-to-last int32&)
		// luke 7/26/02: Modified to return player hand rank (the last int32&)
		bool8 calcPayouts(int32 [3], int32&, int32&, int32&, int32&, int32&);

		bool8 restore(LIRSavedGame*);

	protected:
		LIRConnection*  	conn;
		int32				bet, progressiveBet;
		LIRHand*			dealer;
		LIRHand*			player;
        bool8               raised1, raised2, bTurnOneDone, bGameOK;
        uint8               payFreq, progPayFreq;
        uint8               m_bMalfunction;       // kharmon.  01-05-06.  #4250.  Used when a player hits a big progressive jackpot.

        //
		// *IMPORTANT*  When adding/changing here, be sure to update
		//				constructors/destructor, send(), save(), restore()
		//
};

inline int32
LIRGame::getBet()
{
	return bet;
}

inline int32
LIRGame::getProgressiveBet()
{
	return progressiveBet;
}

inline bool8
LIRGame::isGameOK()
{
	return bGameOK;
}
#endif
